package com.faithbj.dao.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import org.springframework.util.StringUtils;

import com.faithbj.common.dao.impl.BaseDaoImpl;
import com.faithbj.common.model.CheckTotal;
import com.faithbj.common.model.compare.AFMOfficalData;
import com.faithbj.common.model.compare.CivilOfficalData;
import com.faithbj.dao.CivilOfficalDataDao;
@Repository("CivilOfficalDataDao")
public class CivilOfficalDataDaoImpl extends BaseDaoImpl<CivilOfficalData, String> 
        implements CivilOfficalDataDao {
    @Override
    public List<CivilOfficalData> queryListForUpdate(String batchNum, String departmentNum, String mainApplicantCardId) {
        Criteria criteria = this.getSession().createCriteria(CivilOfficalData.class);
        if(StringUtils.hasLength(batchNum)){
            criteria.add(Restrictions.eq("batchNum", batchNum));
        }
        if(StringUtils.hasLength(departmentNum)){
            criteria.add(Restrictions.eq("departmentNum", departmentNum));
        }
        if(StringUtils.hasLength(mainApplicantCardId)){
            criteria.add(Restrictions.eq("mainApplicantCardNum", mainApplicantCardId));
        }
        return criteria.list();
    }
}
